<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%--
参数：
pagerName：Pager在requestScope里面的名字，默认为"pager"。
--%>
<%
	String pageHolderName = (String)request.getAttribute("pagerName");
	if (pagerName == null) {
		pagerName = "pager";
	}
	pageContext.setAttribute("pager",
			request.getAttribute(pagerName));
%>
<div>
	总数：${pager.rowCount}
	<c:choose>
		<c:when test="${pager.firstPage}">[首页] [上一页]</c:when>
		<c:otherwise>
			<c:url var="firstPage" value="">
				<c:param name="${pager.pageIndexKey}" value="1" />
				<c:param name="${pager.rowCountKey}"
					value="${pager.rowCount}" />
			</c:url>
			<c:url var="previousPage" value="">
				<c:param name="${pager.pageIndexKey}"
					value="${pager.pageIndex-1}" />
				<c:param name="${pager.rowCountKey}"
					value="${pager.rowCount}" />
			</c:url>
      [<a href="${firstPage}${pager.params}">首页</a>] [<a
				href="${previousPage}${pager.params}">上一页</a>]</c:otherwise>
	</c:choose>
	<c:choose>
		<c:when test="${pager.lastPage}">[下一页] [末页]</c:when>
		<c:otherwise>
			<c:url var="nextPage" value="">
				<c:param name="${pager.pageIndexKey}"
					value="${pager.pageIndex+1}" />
				<c:param name="${pager.rowCountKey}"
					value="${pager.rowCount}" />
			</c:url>
			<c:url var="lastPage" value="">
				<c:param name="${pager.pageIndexKey}"
					value="${pager.pageCount}" />
				<c:param name="${pager.rowCountKey}"
					value="${pager.rowCount}" />
			</c:url>
      [<a href="${nextPage}${pager.params}">下一页</a>] [<a
				href="${lastPage}${pager.params}">末页</a>]</c:otherwise>
	</c:choose>
	第${pager.pageIndex}/${pager.pageCount}页
	<input type="text" id="pageIndex" style="width: 20px;"
		onkeyup="this.value=this.value.replace(/\D/g,'')"
		onafterpaste="this.value=this.value.replace(/\D/g,'')" />
	<input type="button" value="go"
		onclick="var pageIndex=$('#pageIndex').val();if(!pageIndex)return false;this.disabled=true;location.href='?${pager.pageIndexKey}='+pageIndex+'${pager.params}'" />
	<a href="javascript:location.reload()">刷新</a>
</div>
